<?php
$JO[ "rbt" ]		= JO(array("EN"=>"Ring Back Tone",	"VI"=>"Nhạc Chờ"	));

$JO[ "Artist" ] 	= JO(array("EN"=>"Artist",			"VI"=>"Nghệ Sĩ"		));
$JO["JO_searchid"] 	= JO(array("EN"=>"Search Key",		"VI"=>"Search"		));

/*if(!isset ($_SESSION["JO_account_key"]) || $_SESSION["JO_account_authority"]!="SO"){

	echo "<script>location='http://jukeon.vn/JO/';</script>";
}*/
$searchkeyartist=$JO["JO_searchid"];
$wherequery="";
if(isset ($_REQUEST["searchkey"])){
    $searchkeyartist=$_REQUEST["searchkey"];
    if($searchkeyartist!=$JO["JO_searchid"]){
        $wherequery= "and artist.`name` like '%".$searchkeyartist."%'";
    }
}
$page=1;
if(isset ($_REQUEST["Page"])){$page=$_REQUEST["Page"];}
 if(isset($_GET['sea']))
			$key=$_GET['sea'];
			else
			$key="";
			
			
?>
<script type="text/javascript">

$(document).ready(function() {
    $(".datepicker").datepicker({
        //changeYear:true

    });

    $(".datepicker").mask("99/99/9999", { placeholder: "_" });

});
window.onload = tuyen_du_lieu('VTL8x88','1','<?=$key?>');

function show_content_rbt(telco,rbt_code){
	var str_temp = "";

	switch (telco) {
	case "VTL8x88":
		if(rbt_code!="")
			str_temp = "Vui lòng soạn tin nhắn <span style='color:red;'><b>BH</b> <b>"+rbt_code+"</b></span> gửi <b style='color:red;'>1221</b> (5,000 VND/SMS).<br/>Nếu bạn chưa đăng ký địch vụ nhạc chờ, hãy soạn tin <b>DK</b> gửi <b>1221</b> để đăng ký sử dụng dịch vụ nhạc chờ.";
		else
			str_temp = "Vui lòng soạn tin nhắn <span style='color:red;'><b>BH</b> <b>[Mã Nhạc Chờ]</b></span> gửi <b style='color:red;'>1221</b> (5,000 VND/SMS).<br/>Nếu bạn chưa đăng ký địch vụ nhạc chờ, hãy soạn tin <b>DK</b> gửi <b>1221</b> để đăng ký sử dụng dịch vụ nhạc chờ.";
		break;

	case "VMS8x88":
		if(rbt_code!="")
			str_temp = "Vui lòng soạn tin nhắn <span style='color:red;'><b>CHON</b> <b>"+rbt_code+"</b></span> gửi <b style='color:red;'>9224</b> (5,000 VND/SMS).<br/>Nếu bạn chưa đăng ký địch vụ nhạc chờ, hãy soạn tin <b>DK</b> gửi <b>9224</b> để đăng ký sử dụng dịch vụ nhạc chờ.";
		else
			str_temp = "Vui lòng soạn tin nhắn <span style='color:red;'><b>CHON</b> <b>[Mã Nhạc Chờ]</b></span> gửi <b style='color:red;'>9224</b> (5,000 VND/SMS).<br/>Nếu bạn chưa đăng ký địch vụ nhạc chờ, hãy soạn tin <b>DK</b> gửi <b>9224</b> để đăng ký sử dụng dịch vụ nhạc chờ.";
		break;

	case "GPC8x88":
		if(rbt_code!=""){
			str_temp ="-Bước 1: Soạn tin <span style='color:red;'><b>STUNE</b> <b>"+rbt_code+"</b></span> gửi <b style='color:red;'>9194</b>.<br/>";
			str_temp+="-Bước 2: Soạn tin <span style='color:red;'><b>MD</b> <b>"+rbt_code+"</b></span> gửi <b>9194</b>.(5,000 VND/SMS).";
		}
		else{
			str_temp ="-Bước 1: Soạn tin <span style='color:red;'><b>STUNE</b> <b>[Mã Nhạc Chờ]</b></span> gửi <b style='color:red;'>9194</b>.<br/>";
			str_temp+="-Bước 2: Soạn tin <span style='color:red;'><b>MD</b> <b>[Mã Nhạc Chờ]</b></span> gửi <b>9194</b>.(5,000 VND/SMS).";
		}
		break;

	case "VNM8x88":
		if(rbt_code!="")
			str_temp = "Vui lòng soạn tin nhắn <span style='color:red;'><b>MUA</b> <b>"+rbt_code+"</b></span> gửi <b style='color:red;'>2345</b> (5,000 VND/SMS).<br/>Nếu bạn chưa đăng ký địch vụ nhạc chờ, hãy soạn tin <b>DK HR</b> gửi <b>123</b> để đăng ký sử dụng dịch vụ nhạc chờ.";
		else
			str_temp = "Vui lòng soạn tin nhắn <span style='color:red;'><b>MUA</b> <b>[Mã Nhạc Chờ]</b></span> gửi <b style='color:red;'>2345</b> (5,000 VND/SMS).<br/>Nếu bạn chưa đăng ký địch vụ nhạc chờ, hãy soạn tin <b>DK HR</b> gửi <b>123</b> để đăng ký sử dụng dịch vụ nhạc chờ.";
		break;

	case "SFN8x88":
		if(rbt_code!="")
			str_temp = "";
		else
			str_temp = "";
		break;

	case "BEE8x88":
		if(rbt_code!="")
			str_temp = "Vui lòng soạn tin nhắn <span style='color:red;'><b>CHON</b> <b>"+rbt_code+"</b></span> gửi <b style='color:red;'>1221</b> (5,000 VND/SMS).<br/>Nếu bạn chưa đăng ký địch vụ nhạc chờ, hãy soạn tin <b>CHON 1</b> gửi <b>1221</b> để đăng ký sử dụng dịch vụ nhạc chờ.";
		else
			str_temp = "Vui lòng soạn tin nhắn <span style='color:red;'><b>CHON</b> <b>[Mã Nhạc Chờ]</b></span> gửi <b style='color:red;'>1221</b> (5,000 VND/SMS).<br/>Nếu bạn chưa đăng ký địch vụ nhạc chờ, hãy soạn tin <b>CHON 1</b> gửi <b>1221</b> để đăng ký sử dụng dịch vụ nhạc chờ.";
		break;

	default:
		break;
	}
	str_temp += "";
	str_temp +="<br/><br/>Dịch vụ tìm nhạc chờ:<br/>";
	str_temp +="-Tìm kiếm nhạc chờ theo Tên Bài Hát soạn tin <b>HQ S</b> &lt;<b>Tên Bài Hát</b>&gt; gửi <b>8388</b> (hoặc 8588).<br/>";
	str_temp +="-Tìm kiếm nhạc chờ theo Ca Sĩ soạn tin <b>HQ A</b> &lt;<b>Tên Ca Sĩ</b>&gt; gửi <b>8388</b> (hoặc 8588).<br/>";
	
	return str_temp;
}

function showobj(url,obj) {

	var arr_param 		= url.split("?")[1];
	var str_rbt_code 	= arr_param.split("&")[0].substring(3);
	var str_telco 		= arr_param.split("&")[1].substring(4);
	var str_content		= show_content_rbt(str_telco,str_rbt_code);
	document.getElementById("telco_content").innerHTML= str_content;
	
    document.getElementById(obj).innerHTML="<div style=\"height: 45px;text-align: center;width:100%;background: url(JO_80_image/loading4.gif) center no-repeat\"><br/>Loadding...</div>";
    if (window.XMLHttpRequest) {
    xmlhttp=new XMLHttpRequest(); }
    else {
        xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); }
        xmlhttp.onreadystatechange=function() {
                if (xmlhttp.readyState==4 && xmlhttp.status==200) {
                    document.getElementById(obj).innerHTML=xmlhttp.responseText;
                }
            };

    xmlhttp.open("GET",url,true);
    xmlhttp.send();
    
}
function activediv(o){
	document.getElementById('viettel').className='JO_mobile JO_left JO_mobi';
	document.getElementById('mobifone').className='JO_mobile JO_left JO_mobi';
	document.getElementById('vinafone').className='JO_mobile JO_left JO_mobi';
	document.getElementById('sfone').className='JO_mobile JO_left JO_mobi';
	document.getElementById('vietnammobile').className='JO_mobile JO_left JO_mobi';
	document.getElementById('beeline').className='JO_mobile JO_left JO_mobi';
	o.className='JO_mobile JO_left JO_mobi active';
	
}
function tuyen_du_lieu(str,page,art){
	if (str==""){
		var str="VTL8x88";
	}
	
	var str_content	= show_content_rbt(str,"");
	if (window.XMLHttpRequest){// code for IE7+, Firefox, Chrome, Opera, Safari
		xmlhttp=new XMLHttpRequest();
	}else{// code for IE6, IE5
		xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	}

	xmlhttp.onreadystatechange=function(){
		if (xmlhttp.readyState==4 && xmlhttp.status==200){
			document.getElementById("telco_content").innerHTML= str_content;
			document.getElementById("load").innerHTML=xmlhttp.responseText;
		}
	};

	xmlhttp.open("GET","JO_64_ajax_Top_rbt.php?tel="+str+"&Page="+page+"&art="+art,true);
	xmlhttp.send();
}
</script>

<div class="JO_page">
  <h1>
    <?= $JO["rbt"] ?>
  </h1>
  <h2>&nbsp;</h2>
  <h3>&nbsp;</h3>
</div>
<script type="text/javascript">
    var musics=new Array();
    var n=0;
</script>
<div class="JO_relative" style="width: 960px"> 
<!--trai-->
	<div class="JO_left JO_fix" style="width:240px">
		<div 
			class="JO_box_240"
			style="	margin-top:4px;
					position: relative;margin: 4px;
					padding: 28px 4px 4px 4px;
					width: 222px;"
		>
			<h1
				style="	margin-top		: 0px;
						position		: absolute;
						margin			: 0px;
						padding			: 0px 0px 0px 8px;
						left			: -1px;
						top				: -1px;
						width			: 224px;
						color			: #464646 /* 80 */;
						font-size		: 11px;
						font-family		: tahoma;
						line-height		: 24px;
						background-color: #EBEBEB;"
			><?=$JO[ "Artist" ]?></h1>
			
			<table style="width: 100%">
				<tr >
					<td
						style	= "	text-align		: justify;
									border-bottom	: 0px;
									padding-top		: 0px;
									padding-bottom	: 4px;
									padding-left	: 0px;
									width			: 240px"
						class	= "ds"
					>
					<?php $query= "SELECT * FROM artist LIMIT 20";
						$recordSet = JO_query( $query );
						if( $recordSet -> num_rows ) while( $record = $recordSet -> fetch_array( ) ) {
					?>
						<div 
							style="	width	:210px;
									cursor	:pointer"
							onclick="tuyen_du_lieu('VTL8x88','1',<?=$key?>)"
						>
							<a 
								href="?JO_unit=61_Rbt&key=<?php echo $record['key'] ?>"
							> <?php echo $record['name'] ?></a>
						</div>
					<?php }?>
					</td>
				</tr>
			</table>
		</div>
	</div>
	<!--end trai--> 
	<!--giua--> 
	
	<!-- artist-->
	<div class="JO_left">
	<?php
	if(isset($_GET['sea']))
		$key=$_GET['sea'];
	else
		$key="";
	?>
	<!--end artist-->
	
	<!--RBT-->
	<div 
		class="JO_bar_480"
		style="	width		:460px;
				margin-top	:4px !important"
	>
		<h1 
			style="	width:462px;
					width:460px"
		> RBT Information </h1>
		
		<div 
			class	= "JO_mobile JO_left JO_mobi fix active"	
			style	= "	width:50px !important;
						margin-left:4px;
						border-right:none"
			onclick= "tuyen_du_lieu('VTL8x88','1','<?=$key?>');activediv(this);" id="viettel"
      	>Viettel</div>
      
		<div 
			class	= "JO_mobile JO_left JO_mobi"
			onclick	= "tuyen_du_lieu('VMS8x88','1','<?=$key?>');activediv(this);" id="mobifone"
			style	= "	width:50px !important;
						border-right:none"
		>Mobifone</div>
		
		<div 
			class	= "JO_mobile JO_left JO_mobi"
			onclick	= "tuyen_du_lieu('GPC8x88','1','<?=$key?>');activediv(this);" id="vinafone"
			style	= "	width:60px !important;
						border-right:none"
		>VinaPhone</div>
      
		<div
			class	= "JO_mobile JO_left JO_mobi"
			style	= "	width:80px !important;
						border-right:none"
			onclick	= "tuyen_du_lieu('VNM8x88','1','<?=$key?>');activediv(this);" id="sfone"
		>Vietnammobile</div>
		
		<div
			class	= "JO_mobile JO_left JO_mobi"
			onclick	= "tuyen_du_lieu('SFN8x88','1','<?=$key?>');activediv(this);" id="vietnammobile"
			style	= "	width:50px !important;
						border-right:none;
						border-right:none"
		>Sfone</div>
		
		<div 
			class	= "JO_mobile JO_left JO_mobi"
			onclick	= "tuyen_du_lieu('BEE8x88','1','<?=$key?>');activediv(this);" id="beeline" 
			style	= "width:50px !important;"
		>Beeline</div>
		
		<div class="cleared"></div>
		<div
			id		= "telco_content"
			class	= "JO_bar_480"
			style	= "	width:442px;
						margin:0px 4px 0px 4px;
						padding:4px"
		>	Vui lòng soạn tin nhắn <span style='color:red;'><b>BH</b> <b>[Mã Nhạc Chờ]</b></span> 
			gửi <b style='color:red;'>1221</b> (5,000 VND/SMS).<br/>Nếu bạn chưa đăng ký địch vụ nhạc chờ, 
			hãy soạn tin <b>DK</b> gửi <b>1221</b> để đăng ký sử dụng dịch vụ nhạc chờ.
		</div>
		
		<div 
			style	= "	margin	:0 0 0 4px;
						width	:434px;
						padding	:8px"
			class="JO_bar_480"
			id="rbtplayer"
		>
			<param name="Filename" value="">
			<PARAM NAME="ShowControls" VALUE="-1">
			<PARAM NAME="ShowDisplay" VALUE="0">
			<PARAM NAME="ShowStatusBar" VALUE="-1">
			<PARAM NAME="AutoSize" VALUE="0">
			<param name="AudioStream" value="-1">
			<param name="AutoStart" value="-1">
			<param name="AnimationAtStart" value="-1">
			<param name="AllowScan" value="-1">
			<param name="AllowChangeDisplaySize" value="-1">
			<param name="AutoRewind" value="0">
			<param name="Balance" value="0">
			<param name="BaseURL" value>
			<param name="BufferingTime" value="5">
			<param name="CaptioningID" value>
			<param name="ClickToPlay" value="-1">
			<param name="CursorType" value="0">
			<param name="CurrentPosition" value="-1">
			<param name="CurrentMarker" value="0">
			<param name="DefaultFrame" value>
			<param name="DisplayBackColor" value="0">
			<param name="DisplayForeColor" value="16777215">
			<param name="DisplayMode" value="0">
			<param name="DisplaySize" value="4">
			<param name="Enabled" value="-1">
			<param name="EnableContextMenu" value="-1">
			<param name="EnablePositionControls" value="-1">
			<param name="EnableFullScreenControls" value="0">
			<param name="EnableTracker" value="-1">
			<param name="InvokeURLs" value="-1">
			<param name="Language" value="-1">
			<param name="Mute" value="0">
			<param name="PlayCount" value="1">
			<param name="PreviewMode" value="0">
			<param name="Rate" value="1">
			<param name="SAMILang" value>
			<param name="SAMIStyle" value>
			<param name="SAMIFileName" value>
			<param name="SelectionStart" value="-1">
			<param name="SelectionEnd" value="-1">
			<param name="SendOpenStateChangeEvents" value="-1">
			<param name="SendWarningEvents" value="-1">
			<param name="SendErrorEvents" value="-1">
			<param name="SendKeyboardEvents" value="0">
			<param name="SendMouseClickEvents" value="0">
			<param name="SendMouseMoveEvents" value="0">
			<param name="SendPlayStateChangeEvents" value="-1">
			<param name="ShowCaptioning" value="-1">
			<param name="ShowAudioControls" value="-1">
			<param name="ShowGotoBar" value="0">
			<param name="ShowPositionControls" value="-1">
			<param name="ShowTracker" value="-1">
			<param name="TransparentAtStart" value="0">
			<param name="VideoBorderWidth" value="0">
			<param name="VideoBorderColor" value="0">
			<param name="VideoBorder3D" value="0">
			<param name="Volume" value="-180">
			<param name="WindowlessVideo" value="0">
			<Embed 
				style			= "	z-index:100;
									margin-bottom:0px !important"
				type			= "application/x-mplayer2"
				pluginspage		= "http://www.macromedia.com/go/getflashplayer"
				file			= ""
				src				= ""
				ShowControls	= 1
				ShowDisplay		= 0
				ShowStatusBar	= 1
				width="434px"
				height="70px"
			></embed>
		</div>
    
		<div style="width:460px">
			<div 
				style	= "	width			: 280px;
							margin-left		: 1px;
							float			: left;
							background-color: #EBEBEB;
							padding			:4px 4px 0px 8px;
							height:24px"
			>Rbt name</div>
			
			<div 
				style	= "	width			: 100px;
							float			: left;
							padding			: 4px 4px 0px 8px;
							background-color: #EBEBEB;
							height			:24px"
			>RBT CODE</div>
			
			<div 
				style	= "	width			:35px;
							float			:left;
							padding			:4px 4px 0px 8px;
							background-color: #EBEBEB;
							height			:24px"
			>Play</div>
		</div>
		
		<div 
			id		= "load"
			class	= "JO_bar_480"
			style	= "	width:446px;
						margin:0 0 20px 4px"
		>
		</div>
	</div>
	<!--end RBT-->
	 
</div>
<!--end giua-->
 
<!--phai-->
<div class="JO_left">
	<div class="JO_box_240" style="margin-top:4px">
		<h1 style="margin-top:0px">Artist</h1>
		<table style="width: 100%">
      <tr >
        <td style="text-align:justify;border-bottom:0px;padding:4px;width:240px" class="ds"><img src="JO_81_image_index/110201_06.jpg" width="100%"/></td>
      </tr>
    </table>
  </div>
  <div class="JO_box_240" style="margin-top:8px;">
    <h1 style="margin-top:0px">JukeOn TV</h1>
    <table style="width: 100%">
      <tr >
        <td style="text-align:justify;border-bottom: 0px;padding:0px 8px 0px 4px;width:50px" class="ds"><img src="JO_81_image_index/110201_06.jpg" width="100%" style="margin-top:4px"/></td>
        <td style="text-align:justify;border-bottom: 0px;padding:0px 8px 0px 4px;width:190px" class="ds"> JukeOn TV Show<br />
          Episode 42<br />
          JukeOn TV </td>
      </tr>
    </table>
  </div>
</div>
<!--end phai-->

 
<script type="text/javascript">
     function deleteimg(id){
         location = "JO_05_execution.php?JO_query=deleteimg&imgid="+id;
     }
     function changeupload(c){
         
         if(c.checked){
             var ct="<input type=\"file\" name=\"myfiles\" style=\"width: 300px;\"/>";
//             ct+="<input type=\"file\" name=\"myfiles[]\" style=\"width: 300px;\"/>";
//             ct+="<input type=\"file\" name=\"myfiles[]\" style=\"width: 300px;\"/>";
//             ct+="<input type=\"file\" name=\"myfiles[]\" style=\"width: 300px;\"/>";
//             ct+="<input type=\"file\" name=\"myfiles[]\" style=\"width: 300px;\"/>";
             document.getElementById("spimg").innerHTML=ct;
         }else{
             document.getElementById("spimg").innerHTML="<input type=\"text\" id=\"txtimgupload\" name=\"txtimgupload\" style=\"width: 300px;\"/>";
         }
     }
    function addtop(id){

        var contenttop="<span id='trtop_"+id+"'>";
        contenttop+="<table  style='width: 100%;margin: 0px 4px 0px 0px;'>";
        contenttop+="<tr >";
        contenttop+="<td style='width: 50px' id='tdtopid_"+id+"'>"+id+"</td>";
        contenttop+="<td id='tdtop_"+id+"'>"+document.getElementById("td_"+id).innerHTML+"</td>";
        contenttop+="<td style='width: 12px'><a href='#i' onclick='topup("+id+");'><img src='JO_80_image/JO_27_icon_up_on.png' class='JO_icon' alt='Up' title='Up'/></a></td>";
        contenttop+="<td style='width: 12px'><a href='#i' onclick='topdown("+id+");'><img src='JO_80_image/JO_28_icon_down_on.png' class='JO_icon' alt='Down' title='Down'/></a></td>";
        contenttop+="<td style='width: 12px'><a href='#i' onclick='removetop("+id+");'><img src='JO_80_image/JO_23_icon_delete_on.png' class='JO_icon' alt='Remove' title='Remove'/></a></td>";
        contenttop+="</tr>";
        contenttop+="</table>";
        contenttop+="</span>";
        document.getElementById("tb_top_music").innerHTML+=contenttop;

        //alert(document.getElementById("tb_top_music").innerHTML);
        var del = document.getElementById("tr_"+id);
        del.parentNode.removeChild(del);
        musics[n]=id;
        n++;
        //document.getElementById("kqkq").innerHTML=musics;
        create_top();
    }
    function removetop(id){

        var contentmusic="<span id='tr_"+id+"'>";
        contentmusic+="<table style='width: 100%;margin: 0px 4px 0px 0px;' >";
        contentmusic+="<tr ><td id='td_"+id+"'>"+document.getElementById("tdtop_"+id).innerHTML+"</td>";
        contentmusic+="<td style='width:12px'><a href='#i' onclick='addtop("+id+");'><img src='JO_80_image/add_top.png' class='JO_icon' alt='Add To Top Music' title='Add To Top Music'/></a></td>";
        contentmusic+="</tr>";
        contentmusic+="</table>";
        contentmusic+="</span>";
        document.getElementById("tb_music").innerHTML+=contentmusic;
        var del=document.getElementById("trtop_"+id);
        del.parentNode.removeChild(del);
        for(var i=0;i<musics.length;i++){
            if(musics[i]==id){
                musics[i]=undefined;
                create_top();
                break;
            }
        }

    }
    function topup(id){

        //alert(document.getElementById("trtop_"+id).id+":id");
        for(var i=0;i<musics.length;i++){
            if(musics[i]==id && i>0){
                var j=1;
                while(musics[i-j]==undefined && i-j>=0){

                    j++;
                }

                var contenttmp=document.getElementById("trtop_"+musics[i]).innerHTML;
//                var contenttmp2=document.getElementById("trtop_"+musics[i-j]);
//                var pct=contenttmp.parentNode;
//                pct.replaceChild(contenttmp,contenttmp2);
//                pct.replaceChild(contenttmp2,contenttmp);
                document.getElementById("trtop_"+musics[i]).innerHTML=document.getElementById("trtop_"+musics[i-j]).innerHTML;;
                document.getElementById("trtop_"+musics[i-j]).innerHTML=contenttmp;

                var idtmptr=document.getElementById("trtop_"+musics[i]).id;
                var idtmptr2=document.getElementById("trtop_"+musics[i-j]).id;
                document.getElementById("trtop_"+musics[i]).id=document.getElementById("trtop_"+musics[i]).id+"abc123";
                document.getElementById("trtop_"+musics[i-j]).id=idtmptr;
                document.getElementById("trtop_"+musics[i]+"abc123").id=idtmptr2

                //hoan vi 2 element
                var tmp=musics[i];
                musics[i]=musics[i-j];
                musics[i-j]=tmp;

                //document.getElementById("kqkq").innerHTML=musics;
                create_top();
                //alert(musics);
                break;
            }
        }

    }
    function topdown(id){
        //alert(document.getElementById("trtop_"+id).id+":id");
        for(var i=0;i<musics.length;i++){
            if(musics[i]==id){
                var j=1;
                while(musics[i+j]==undefined && i+j<musics.length){

                    j++;
                }
                if(musics[i+j]==undefined){ return;}
                //alert(musics[i]+":"+musics[i+j]);



                var contenttmpdown=document.getElementById("trtop_"+musics[i]).innerHTML;
                document.getElementById("trtop_"+musics[i]).innerHTML=document.getElementById("trtop_"+musics[i+j]).innerHTML;
                document.getElementById("trtop_"+musics[i+j]).innerHTML=contenttmpdown;
                //alert(document.getElementById("trtop_"+musics[i+j]).id);

                var idtmptr=document.getElementById("trtop_"+musics[i]).id;
                var idtmptr2=document.getElementById("trtop_"+musics[i+j]).id;
                document.getElementById("trtop_"+musics[i]).id=document.getElementById("trtop_"+musics[i]).id+"abc123";
                document.getElementById("trtop_"+musics[i+j]).id=idtmptr;
                document.getElementById("trtop_"+musics[i]+"abc123").id=idtmptr2;

                //hoan vi 2 element
                var tmp=musics[i];
                musics[i]=musics[i+j];
                musics[i+j]=tmp;

                //document.getElementById("kqkq").innerHTML=musics;
                create_top();
                //alert(musics);
                break;
            }
        }

    }
    function save(){

        var top=";";
        for(var i=0;i<musics.length;i++){
            if(musics[i]!=undefined){
                top+=musics[i]+";";
            }
        }
        //if(top==";"){return;}
		//alert(top);
        //
		//document.getElementById( "JO_integration_asynchronous" ).src = "JO_05_execution.php?JO_query=SaveTopArtist&top="+top+"&artist=<?=$artistid?>";
		location = "JO_05_execution.php?JO_query=SaveTopArtist&top="+top+"&artist=<?=$artistid?>";
    }
    function create_top()
    {
        var ntop=1;
        for(var i=0;i<musics.length;i++){
            if(musics[i]!=undefined){
                document.getElementById("tdtopid_"+musics[i]).innerHTML=ntop;
                ntop++;
            }
        }
    }
    function changeartist(c){
        location="JO_00_integration.php?JO_unit=31_Artist&artistid="+c.value+"&searchkey=<?=urlencode($searchkeyartist)?>";
    }
    function searchfocus(v){
        if(v.value=="<?=$JO["JO_searchid"]?>")
            v.value="";
    }
    function searchblur(v){
        var s=v.value;
        //Cắt bỏ những khoảng trắng đầu chuỗi
        while(s.charCodeAt(0)==32)
            s=s.substring(1);
        //Cắt bỏ những khoảng trắng cuối chuỗi
        while(s.charCodeAt(s.length-1)==32)
            s=s.substring(0,s.length-1);
        if(s=="")
            v.value="<?=$JO["JO_searchid"]?>";
        else
            v.value=s;
    }
    window.onload = function() {
        document.getElementById("txtsearchartist").focus();
    }
    function searchKeyPress(e)
    {
        // look for window.event in case event isn't passed in
        if (window.event) { e = window.event; }
        if (e.keyCode == 13)
        {
            key=document.getElementById("txtsearchartist").value;
            if(key=="<?=$JO["JO_searchid"]?>" || key==""){

                location=("JO_00_integration.php?JO_unit=31_Artist");
            }else{

                location=("JO_00_integration.php?JO_unit=31_Artist&searchkey="+document.getElementById("txtsearchartist").value);
            }

        }
    }
    function sendurl(p){
            <?
            if($searchkeyartist==$JO["JO_searchid"]){
              ?>
                location=("JO_00_integration.php?JO_unit=62_Top_Rbt&Page=1&key="+p);
                <?
            }else{
                ?>
                location=("JO_00_integration.php?JO_unit=62_Top_Rbt&Page=1&key="+p+"&searchkey=<?=urlencode($searchkeyartist)?>");
                <?
            }
            ?>

    }
    function sendurl2(p){
            <?
            if($searchkeyartist==$JO["JO_searchid"]){
              ?>
                location=("JO_00_integration.php?JO_unit=31_Artist&Page=<?=$page?>&artistid="+p);
                <?
            }else{
                ?>
                        location=("JO_00_integration.php?JO_unit=31_Artist&Page=<?=$page?>&artistid="+p+"&searchkey=<?=  urlencode($searchkeyartist)?>");
                <?
            }
            ?>
	
	
    }
 </script>
</div>